package com.zuihai.app.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.zuihai.app.mvp.contract.DetailFavourContract;
import com.zuihai.app.mvp.model.api.service.DetailService;
import com.zuihai.app.mvp.model.entity.BaseJson;
import com.zuihai.app.mvp.model.entity.Favour;
import com.zuihai.app.mvp.model.entity.MessageResponse;

import javax.inject.Inject;

import rx.Observable;

/**
 * Created by Administrator on 2017/6/8 0008.
 */

@FragmentScope
public class DetailFavourModel extends BaseModel implements DetailFavourContract.Model {
    private Gson mGson;
    private Application mApplication;
    private DetailService mDetailService;

    @Inject
    public DetailFavourModel(IRepositoryManager repositoryManager, Gson gson, Application application) {
        super(repositoryManager);
        this.mGson = gson;
        this.mApplication = application;
        mDetailService = repositoryManager.obtainRetrofitService(DetailService.class);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseJson<Favour.User>> secretFavourUsers(String id, String userId, int pageIndex) {
        return mDetailService.secretFavourUsers(id, userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<Favour.User>> headlineFavourUsers(String id, String userId, int pageIndex) {
        return mDetailService.headlineFavourUsers(id, userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<Favour.User>> diaryFavourUsers(String id, String userId, int pageIndex) {
        return mDetailService.diaryFavourUsers(id, userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<Favour.User>> serverFavourUsers(String id, String userId, int pageIndex) {
        return mDetailService.serverFavourUsers(id, userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<Favour.User>> shopFavourUsers(String id, String userId, int pageIndex) {
        return mDetailService.shopFavourUsers(id, userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<Favour.User>> commodtiyFavourUsers(String id, String userId, int pageIndex) {
        return mDetailService.commodtiyFavourUsers(id, userId, pageIndex);
    }

    @Override
    public Observable<MessageResponse> requestCare(String id, String userId, int isCare) {
        return mDetailService.requestCare(id, userId, isCare);
    }
}
